<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        padding: 0;
        margin: 0;
    }
    .box{
        width: 500px;
        height: 500px;
        background: skyblue;
        position: relative;
    }
    .box1{
        width: 50px;
        height: 50px;
        background: yellow;
        position:absolute;
        left: 0;
        top:0;
    }
</style>
<body>
    <!-- <script>
        function checkPhoneKey(e) {
            //your implement
            return(e)
        }
        </script>
        <input onkeydown="return checkPhoneKey(event.key)" placeholder="请输入手机号" type="tel">
        <div id="idm"></div> -->
        <div class="box">
            <div class="box1"></div>
        </div>
</body>
<script>
    var a=0;
    window.addEventListener('keydown',function(e){
        // console.log(e)
        if(e.key=="ArrowRight"){
            a=a+20
            document.querySelector('.box1').style.left=a+'px'
        }
    })
</script>
</html>